<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
class Common_Model extends CI_Model 
{
	function __construct() {
        parent::__construct();       
    }

	function getSlideshows($section='home', $user_id=0) 
	{
		$this->db->select('image');
		$this->db->from('banner_image');
		//$this->db->join('banner_image', 'banner_image.banner_image_id = banner_image_description.banner_image_id and banner_image_description.language_id="'.$this->session->userdata('langID').'"');
		$this->db->join('banner', 'banner_image.banner_id = banner.banner_id');
		$this->db->where('banner.name', $section); 
        if ($user_id != 0) {
            $this->db->where('banner.user_id', $user_id);
        }
        else {
            $this->db->where('banner.user_id');
        }
		$this->db->order_by("banner_image.sort_order", "desc");
		$query = $this->db->get();
		return $query->result_array();
	}
    
    function getContactInfo($user_id) {
        $sql = "SELECT cc.*, c.name as company_name FROM client_contact cc INNER JOIN company c ON cc.user_id = c.id_company WHERE cc.user_id = $user_id";
        $query = $this->db->query($sql);
        return $query->row();
    }

}